#ifndef __ENGINE_H__
#define __ENGINE_H__

#include <dml/dml.h>
#include <extensions/gldml.h>

#include <conio.h>
#include <stdlib.h>
#include <al/al.h>
#include <al/alc.h>
#include <al/alut.h>

#define MAXFACES 65535
#define MAXVERTICES 65535
 
typedef struct {
    float x,y,z;
    } s_vector3d;

typedef struct {
    float x,y,z;
    } s_vertex;

typedef struct {
    float x,y,z;
    } s_normals;

typedef struct {
    float u,v;
    } s_tvertex;

typedef struct {
    int a,b,c;
    int ta,tb,tc;
    int na,nb,nc;
    } s_face;

typedef struct {
    s_vertex *vertex;
    s_tvertex *tvertex;
    s_face *face;
    s_normals *normals;
    int numvertices,numtvertices,numfaces,numnormals;
    } s_mesh;

//objecten in het spel (model + texture)
typedef struct {
    s_mesh model;
    int textureid;
    } s_object;
    
typedef struct {
    ALenum format;
	ALsizei size;
	ALvoid* data;
	ALsizei freq;
	ALboolean loop;
	ALuint Source;
	ALuint Buffer;
} s_openal;
    
    

void drawobject(s_mesh *mesh);                                                  //teken  object
void LoadMesh(char *fn,s_mesh *mesh);                                           //laad   object
void DeleteMesh(s_mesh *mesh);                                                  //delete object
void color(int r, int g, int b);
void Draw_Quads(float x, float y, float z, float size);

bool CheckCollision(s_mesh *model1, s_mesh *model2, float x_model1, float y_model1, float z_model1, float x_model2, float y_model2, float z_model2);
ALboolean LoadWav(char *fn,s_openal *sound, float pos_x,float pos_y,float pos_z, float velo_x, float velo_y, float velo_z);                                    //laad een sound in openal
ALboolean InitOpenAL();
void MoveSound(s_openal *sound, float x, float y, float z);
void DeleteSound(s_openal *sound);
void PlaySound(s_openal *sound);
void StopSound(s_openal *sound);
#endif
